package com.ruoyi.unit.system.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.unit.system.domain.MdUnitMeasure;
import com.ruoyi.unit.system.service.MesUnitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/mes/unit")
public class MesUnitController extends BaseController {

    @Autowired
    MesUnitService mdUnitService;

    @RequestMapping("/list")
    public TableDataInfo list(SysRole role){
        startPage();
        List<MdUnitMeasure> mdUnitMeasures = mdUnitService.list(role);
        return getDataTable(mdUnitMeasures);
    }

    @RequestMapping("/add")
    public void add(@RequestBody MdUnitMeasure mdUnitMeasure){
        mdUnitService.add(mdUnitMeasure);
    }
}
